2 * MediaWiki Widgets - NamespaceInputWidget class.
4 * @copyright 2011-2015 MediaWiki Widgets Team and others; see AUTHORS.txt
5 * @license The MIT License (MIT); see LICENSE.txt
10 * Creates a mw.widgets.NamespaceInputWidget object.
12 * This is not a complete implementation and is not intended for public usage. It only exists
13 * because of HTMLForm shenanigans.
17 * @extends OO.ui.Widget
20 * @param {Object} [config] Configuration options
21 * @cfg {OO.ui.DropdownInputWidget} namespace Widget to include
22 * @cfg {OO.ui.CheckboxInputWidget|null} invert Widget to include
23 * @cfg {OO.ui.CheckboxInputWidget|null} associated Widget to include
24 * @cfg {string|null} allValue Value for "all namespaces" option, if any
26 mw
.widgets
.NamespaceInputWidget
= function MwWidgetsNamespaceInputWidget( config
) {
28 mw
.widgets
.NamespaceInputWidget
.parent
.call( this, config
);
31 this.namespace = config
.namespace;
32 this.invert
= config
.invert
;
33 this.associated
= config
.associated
;
34 this.allValue
= config
.allValue
;
37 this.namespace.connect( this, { change
: 'updateCheckboxesState' } );
41 .addClass( 'mw-widget-namespaceInputWidget' )
43 this.namespace.$element
,
44 this.invert
? this.invert
.$element
: '',
45 this.associated
? this.associated
.$element
: ''
47 this.updateCheckboxesState();
52 OO
.inheritClass( mw
.widgets
.NamespaceInputWidget
, OO
.ui
.Widget
);
57 * Update the disabled state of checkboxes when the value of namespace dropdown changes.
59 mw
.widgets
.NamespaceInputWidget
.prototype.updateCheckboxesState = function () {
61 this.invert
.getField().setDisabled( this.namespace.getValue() === this.allValue
);
63 if ( this.associated
) {
64 this.associated
.getField().setDisabled( this.namespace.getValue() === this.allValue
);
68 }( jQuery
, mediaWiki
) );